<!doctype html>

<html>
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>phpman php中文分词</title>
    <style>
        body{font:12px arial;text-align:center;background:#fff}
        body,p,form{margin:0;padding:0}body,form,#lg{position:relative}td{text-align:left}img{border:0}a{color:#00c}a:active{color:#f60}#u{padding:7px 10px 3px 0;text-align:right}#m{width:650px;margin:0 auto}#nv{font-size:16px;margin:0 0 4px -32px}#nv a,#nv b,#su,#lk{font-size:14px}#lg{margin:-17px 0 9px}#fm{padding-left:111px;text-align:left}#kw{width:391px;line-height:16px;padding:3px 1px;margin:0 6px 0 0;font:16px arial}#su{width:78px;height:28px;line-height:24px}#kw,#su{vertical-align:middle}#lk{margin:33px 0}#lk span{font:14px "宋体"}#lm{height:60px}#lh{margin:16px 0 5px;font:12px "宋体"}#lh a{font:12px arial}#hp{position:absolute;line-height:14px;margin:0 0 0 6px;top:-1px;*top:2px}#cp,#cp a{color:#77c}
    </style>
</head>
<body>
<p id="u"><a href="http://phpman.cn">phpman首页</a></p>
<div id="m">
    <p id="lg"><img src="./images/logo.png" width="185" height="60" usemap="#mp"></p>
    <form name="f" action="./index.php" method="post" >
        <input type="text" name="key" id="kw" value="<?php echo isset($_POST['key']) ? $_POST['key'] : ''; ?>" >
        <input type="submit" name="submit" value="分一下" id="su">
        <?php
        /**
         * 分词
         * @author lgm
         */
        if(isset($_POST['submit'])) {
            require("class_split.php");
            $str = mysql_real_escape_string($_POST['key']);
            $start_time = microtime(true);
            echo '<h2>句子:'.$str.'</h2>';
            $sp = new SW();
            $keywords = $sp->run($str,'',2);
            echo '<h2>'.$sp->print_splited_word().'</h2>';
            echo '耗时:'.(microtime(true) - $start_time).'秒';
        }
        ?>

        <!-- Duoshuo Comment BEGIN -->
        <div class="ds-thread" style="width: 600px; text-align: center">
        </div>
        <script type="text/javascript">
            var duoshuoQuery = {short_name:"phpman"};
            (function() {
                var ds = document.createElement('script');
                ds.type = 'text/javascript';ds.async = true;
                ds.src = 'http://static.duoshuo.com/embed.js';
                ds.charset = 'UTF-8';
                (document.getElementsByTagName('head')[0]
                        || document.getElementsByTagName('body')[0]).appendChild(ds);
            })();
        </script>
        <!-- Duoshuo Comment END -->

    </form>
</div>

</body>
</html>

